package com.tancire.net.service.impl;

import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Resource;

import com.tancire.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.tancire.net.mapper.AuthLogMapper;
import com.tancire.net.domain.AuthLog;
import com.tancire.net.service.IAuthLogService;

/**
 * 认证日志Service业务层处理
 *
 * @author chenchao
 * @date 2023-12-06
 */
@Service
public class AuthLogServiceImpl implements IAuthLogService {
    @Resource
    private AuthLogMapper authLogMapper;

    /**
     * 查询认证日志
     *
     * @param id 认证日志主键
     * @return 认证日志
     */
    @Override
    public AuthLog selectAuthLogById(Long id) {
        return authLogMapper.selectAuthLogById(id);
    }

    /**
     * 查询认证日志列表
     *
     * @param authLog 认证日志
     * @return 认证日志
     */
    @Override
    public List<AuthLog> selectAuthLogList(AuthLog authLog) {
        return authLogMapper.selectAuthLogList(authLog);
    }

    /**
     * 新增认证日志
     *
     * @param authLog 认证日志
     * @return 结果
     */
    @Override
    public int insertAuthLog(AuthLog authLog) {
        authLog.setCreateTime(DateUtils.getNowDate());
        return authLogMapper.insertAuthLog(authLog);
    }

    /**
     * 修改认证日志
     *
     * @param authLog 认证日志
     * @return 结果
     */
    @Override
    public int updateAuthLog(AuthLog authLog) {
        return authLogMapper.updateAuthLog(authLog);
    }

    /**
     * 批量删除认证日志
     *
     * @param ids 需要删除的认证日志主键
     * @return 结果
     */
    @Override
    public int deleteAuthLogByIds(Long[] ids) {
        return authLogMapper.deleteAuthLogByIds(ids);
    }

    /**
     * 删除认证日志信息
     *
     * @param id 认证日志主键
     * @return 结果
     */
    @Override
    public int deleteAuthLogById(Long id) {
        return authLogMapper.deleteAuthLogById(id);
    }

    /**
     *
     * @param authId
     * @param startTime
     * @param endTime
     * @return
     */
    @Override
    public List<AuthLog> selectAuthListBySourceId(Long authId, String startTime, String endTime) {
        return this.authLogMapper.selectAuthListBySourceId(authId, startTime, endTime);
    }

    /**
     * 统计昨日激活数量
     *
     * @return
     */
    @Override
    public BigDecimal selectYesterdayAuthTotal(String startTime, String endTime) {
        return this.authLogMapper.selectYesterdayAuthTotal(startTime, endTime);
    }
}
